import axios from 'axios';

export default {
    install: function(Vue, options) {

        let service = {
            // 查询通行证数量，包含通行证总数和今日注册通行证数量
            QueryPassportCount: function() {
                return axios.get('/admin/dashboard/passport/count');
            },

            // 查询比赛数量，包含比赛总数和今日注册比赛数量
            QueryCompeteCount: function() {
                return axios.get('/admin/dashboard/compete/count');
            },

            // 查询总支付金额，包含总支付金额和今日支付金额
            QueryTotalPrice: function() {
                return axios.get('/admin/dashboard/payment/total');
            },

            // 按日统计支付信息，包括支付总金额、支付笔数、审核总金额、审核笔数
            StatPaymentTotalPrice(createTime0, createTime1) {
                let condition = {
                    CreateTime0: createTime0,
                    CreateTime1: createTime1
                };
                return axios.post('/admin/dashboard/payment/price/stat', condition);
            },

            // 统计各省份注册通行证人数
            StatPassportByRegion() {
                return axios.get('/admin/dashboard/passport/count/region');
            },

            // 根据比赛组别和项目统计报名人数
            StatCompeteCountWithGroup() {
                return axios.get('/admin/dashboard/compete/count/group');
            }
        }

        Vue.prototype.$DashboardService = service;
    }
}